package org.demo5;

import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MainTest {
    private JobLauncher jobLauncher;

    public void setJobLauncher(JobLauncher jobLauncher) {
        this.jobLauncher = jobLauncher;
    }

    public static void main(String[] args) {
        MainTest mainTest = new MainTest();
        mainTest.start();
    }

    public void start() {

        ApplicationContext context = new ClassPathXmlApplicationContext("demo5/demo5-job.xml");
        context.getAutowireCapableBeanFactory().autowireBeanProperties(this, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
        System.out.println(this.jobLauncher);
    }

}
